package tech.com.commoncore.utils;

import android.app.Activity;
import android.view.WindowManager;

public class BgAlphaUtil {
    //---------------------------------------------------------------------------
    public  static void bgAlpha(Activity context,float bgAlpha) {
        WindowManager.LayoutParams lp = context.getWindow().getAttributes();
        lp.alpha = bgAlpha; //0.0-1.0
        context.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        context.getWindow().setAttributes(lp);
        context.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); //设置背景闪屏问题,坑爹.

    }
    public  static void bgAlpha(Activity context) {
        bgAlpha(context,0.4f);
    }
}
